package com.mt.demo.controller;

import com.mt.demo.domain.AjaxResult;
import com.mt.demo.domain.MtMeeting;
import com.mt.demo.domain.TableDataInfo;
import com.mt.demo.service.IMtMeetingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletResponse;
import java.util.List;

/**
 * 会议主Controller
 * 
 * @author gary
 * @date 2025-08-11
 */
@RestController
@RequestMapping("/mt/mtMeeting")
public class MtMeetingController extends BaseController
{
    @Autowired
    private IMtMeetingService mtMeetingService;

    /**
     * 查询会议主列表
     */
    @GetMapping("/list")
    public TableDataInfo list(MtMeeting mtMeeting)
    {
        startPage();
        List<MtMeeting> list = mtMeetingService.selectMtMeetingList(mtMeeting);
        return getDataTable(list);
    }

    /**
     * 导出会议主列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, MtMeeting mtMeeting)
    {
        List<MtMeeting> list = mtMeetingService.selectMtMeetingList(mtMeeting);
//        ExcelUtil<MtMeeting> util = new ExcelUtil<MtMeeting>(MtMeeting.class);
//        util.exportExcel(response, list, "会议主数据");
    }

    /**
     * 获取会议主详细信息
     */
    @GetMapping(value = "/{meetingId}")
    public AjaxResult getInfo(@PathVariable("meetingId") Long meetingId)
    {
        return success(mtMeetingService.selectMtMeetingByMeetingId(meetingId));
    }

    /**
     * 新增会议主
     */
    @PostMapping
    public AjaxResult add(@RequestBody MtMeeting mtMeeting)
    {
        return toAjax(mtMeetingService.insertMtMeeting(mtMeeting));
    }

    /**
     * 修改会议主
     */
    @PutMapping
    public AjaxResult edit(@RequestBody MtMeeting mtMeeting)
    {
        return toAjax(mtMeetingService.updateMtMeeting(mtMeeting));
    }

    /**
     * 删除会议主
     */
	@DeleteMapping("/{meetingIds}")
    public AjaxResult remove(@PathVariable Long[] meetingIds)
    {
        return toAjax(mtMeetingService.deleteMtMeetingByMeetingIds(meetingIds));
    }
}
